I am basing this off of code I have written that has been working without any issues. I have built a skip list to contain the values i want to put into an enumerated type. here is the code I am trying to modify the type with and it is resulting in an Exception Access Violation, "-R-E- DXL: <Line:90> An unexpected error has occurred: doors.exe caused an EXCEPTION_ACCESS_VIOLATION in module doors.exe at 0023:0082CA9E"
string temp, insVal, errMsg = "Error Updating Enum\n"
int j = 0
for temp in enumVals do {
insVal = (string key(enumVals))
put(aModify, insVal, j, 0)
put(aModify, intOf(temp), j, 1)
put(aModify, -1, j, 2)
if (insVal == newVal){
put(aModify, -1, j, 3)
} else {
put(aModify, j, j, 3)
}
j++
}
at = modify(at, enumName, aModify, errMsg) // this line causes the error
previously in the code I check to see if at is null (and it's not) and I delete both the skip list and array at the end of the function. I also set the current module to be the one containing the enumeration. any ideas?
-Adam
SystemAdmin - Wed Aug 03 16:51:02 EDT 2011 |
|
Re: Modify an enumerated attribute type llandale - Wed Aug 03 17:34:56 EDT 2011
Wow, never seen the modify(at) command using an "Array", but I now see it in the doors.exe file. don't know what the format of the Array is supposed to look like; so I'm guessing:
o Make sure you delete and re-create the Array each time or it will have left overs from the last time.
o Its seems as though you put in your skip list a Key of "Enumerated name" and a Data of "number" in string format; resulting in enumerations in alpha order. If you wanted it sorted by number you should put in the skip the integer number and data enumerated name. That will allow you to insert enumerations in non-alpha order. Then retrieve with:
for insVal in enumVals do;{ iNum = (int key enumVals) ...}
o I'm guessing that you have a mis-match between your Skip "put" and the way you are retrieving it, swapping the Key and the Data wreaking havok when the info is used; using a string pointing out into never-never land. Don't forget, the Skip loop is on the DATA, the 3rd parameter in the put.
o Since your Skip has key 'string', you need to use "createString()" when creating it.
o Usually the "x" coordinates are the fixed columns and the "y" coordinates are the variable number of rows, so I wonder if you should reverse the order of the Array puts:
put(aModify, iNum, 2, j).
o You could surround your "modify" command with noError() and lastError() and may trap the exception allowing you to print errMsg and might get a better idea what's the problem.
o Just in case: you must set the current module after opening any other module, so you might as well do it right at this code that requires it.
Where is the modify(at, Array) command documented?
|
|
Re: Modify an enumerated attribute type SystemAdmin - Wed Aug 03 18:03:32 EDT 2011 llandale - Wed Aug 03 17:34:56 EDT 2011
Wow, never seen the modify(at) command using an "Array", but I now see it in the doors.exe file. don't know what the format of the Array is supposed to look like; so I'm guessing:
o Make sure you delete and re-create the Array each time or it will have left overs from the last time.
o Its seems as though you put in your skip list a Key of "Enumerated name" and a Data of "number" in string format; resulting in enumerations in alpha order. If you wanted it sorted by number you should put in the skip the integer number and data enumerated name. That will allow you to insert enumerations in non-alpha order. Then retrieve with:
for insVal in enumVals do;{ iNum = (int key enumVals) ...}
o I'm guessing that you have a mis-match between your Skip "put" and the way you are retrieving it, swapping the Key and the Data wreaking havok when the info is used; using a string pointing out into never-never land. Don't forget, the Skip loop is on the DATA, the 3rd parameter in the put.
o Since your Skip has key 'string', you need to use "createString()" when creating it.
o Usually the "x" coordinates are the fixed columns and the "y" coordinates are the variable number of rows, so I wonder if you should reverse the order of the Array puts:
put(aModify, iNum, 2, j).
o You could surround your "modify" command with noError() and lastError() and may trap the exception allowing you to print errMsg and might get a better idea what's the problem.
o Just in case: you must set the current module after opening any other module, so you might as well do it right at this code that requires it.
Where is the modify(at, Array) command documented?
I found the modify(at, Array) command on this forum a few months ago. As I recall, there is also a newer, more robust command to modify that takes 4 seperate arrays that contain the same information but I had trouble getting that command to work, especially when I did not know how many elements there were going to be. I like this command because the dynamic array is easy to build. I havent ever had any problems with this command until now but I think it was just a DOORS Hiccup - I caused an Exception Access Violation at another part of the code and fixed it but never restarted DOORS, once I restarted DOORS I didnt have any issues with the code. The skip list was built the way I wanted it to be - I used createString() and even adopted your convention of adding the comment // KEY: type; DATA: type to make sure I don't forget. In this case, the DATA is irrelevant, I am just using the skip as an easy way to sort and avoid duplicates. And I initally thought the same about the array coordinates needing flipped but thats not the case. Array,0 contains the strings for the enumerated type, Array,1 contains the associated values, Array,2 contains the color mapping (-1 = don't care), and Array,3 contains the mapping to the previous type (-1 = new value). And as far as the enumeration goes, I do not care about the associated value, color, or previous mapping - I am just using it for the drop down functionality. Thanks for your help.
-Adam
|
|
Re: Modify an enumerated attribute type SystemAdmin - Wed Aug 03 18:05:36 EDT 2011 SystemAdmin - Wed Aug 03 18:03:32 EDT 2011
I found the modify(at, Array) command on this forum a few months ago. As I recall, there is also a newer, more robust command to modify that takes 4 seperate arrays that contain the same information but I had trouble getting that command to work, especially when I did not know how many elements there were going to be. I like this command because the dynamic array is easy to build. I havent ever had any problems with this command until now but I think it was just a DOORS Hiccup - I caused an Exception Access Violation at another part of the code and fixed it but never restarted DOORS, once I restarted DOORS I didnt have any issues with the code. The skip list was built the way I wanted it to be - I used createString() and even adopted your convention of adding the comment // KEY: type; DATA: type to make sure I don't forget. In this case, the DATA is irrelevant, I am just using the skip as an easy way to sort and avoid duplicates. And I initally thought the same about the array coordinates needing flipped but thats not the case. Array,0 contains the strings for the enumerated type, Array,1 contains the associated values, Array,2 contains the color mapping (-1 = don't care), and Array,3 contains the mapping to the previous type (-1 = new value). And as far as the enumeration goes, I do not care about the associated value, color, or previous mapping - I am just using it for the drop down functionality. Thanks for your help.
-Adam
Didnt mean to turn that stuff bold, here is how that array is built...
// Array[*,0] contains strings
// Array[*,1] contains associated index
// Array[*,2] contains color value, -1 = don't care
// Array[*,3] contains mapping to previous type, -1 = new value
|
|